package com.itheima.stringdemo;

public class stringDemo11 {
    public static void main(String[] args) {
        //敏感词替换
        //1.获取说到的话
        String talk = "你玩的真好，以后不要再玩了，TMD";

        //2.定义一个敏感词词库
        String[] arr = {"TMD","CNM","SB","MLGB"};
        //2.敏感词替换
        //String result = talk.replace("TMD","***");

        //3.循环得到数组中每一个敏感词，依次替换
        for (int i = 0; i < arr.length; i++) {
            talk = talk.replace(arr[i],"***");
        }


        System.out.println(talk);
    }
}
